﻿<!DOCTYPE html>
<html>
  <head>
    <title>后台管理</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <link rel="stylesheet" type="text/css" href="css/pubStyle.css">
    <link rel="stylesheet" type="text/css" href="css/adminman.css">
    <style type="text/css">
<!--
body {
	background-color: #F7F7F7;
	margin: 0px;
}
-->
</style>
<script type="text/javascript" src="js/cookie_util.js"></script>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/sofa.js"></script>
<script type="text/javascript" src="js/adminManager.js"></script>
<script type="text/javascript">
    var acctId = getCookie("uid");
    if (acctId == null) {
        alert("登录状态已失效,请重新登录");
        window.location.href = "index.html";
    }
    var realName = getCookie("realName");
    var userType = getCookie("userType");
    if(userType!=0){
        alert("对不起,您不是管理员,请申请管理员账号后再来吧~");
        window.location.href="homePage.html";
    }
    //获取用户列表
    getUserList("0");
    $(function(){
        $("#acctId").html(realName);
        logOut();//退出登录功能
        showDiv('yhman','mantablediv');
        setDefault();//给三个排序的按钮设置默认值
        //查看用户列表
        $("#managerUser").click(function(){
            getUserList("0");
        });
        //查看沙发列表
        $("#managerSofa").click(function(){
            getSofaList(0);
        });
        //查看订单列表
        $("#managerOrder").click(function(){
            getOrderList(0);
        });
        //查看留言列表
        $("#managerMsg").click(function(){
            getMassageList(0);
        });
        //查看留言列表
        $("#managerTravel").click(function(){
            getTravelList(0);
        });
        
    });
    
    //排序查询
    function sort(input){
        var type = $(input).data("type");
        var value = $(input).data("value");
        transSort(type,value);
    }
    
    //排序
    function transSort(type,value){
        if(type=="user"){
            getUserList(value);
        }else if(type=="sofa"){
            getSofaList(value);
        }else if(type=="order"){
            getOrderList(value);
        }else if(type=="msg"){
            getMassageList(value);
        }else if(type=="travel"){
            getTravelList(value);
        }
    }
    
</script>
</head>
  
  <body class="firstPage">
      <div class="top">
          <div class="top-page">
          	<span id="logtitle"><a id="atitle" href="homePage.html">沙客综合管理</a></span>
              <div id="loginfo">
                  <span>当前登陆：</span>
                  <span id="acctId"></span>
                  <span><a href="Javascript:void(0)" id="safeout" target="_self">安全退出</a></span>
              </div>
          </div>
      </div>
      <div class="main-content">
          <div class="main-page">
                <!--按钮-->
                <div class="admin-nav">
                    <ul style="margin-top: 0px;margin-bottom: 0px;padding-left: 0px;">
                        <li class="admin-li"><a id="managerUser" href="Javascript:void(0)" onclick="showDiv('yhman','mantablediv')">用户管理</a></li>
                        <li class="admin-li"><a id="managerSofa" href="Javascript:void(0)" onclick="showDiv('sfman','mantablediv')">沙发管理</a></li>
                        <li class="admin-li"><a id="managerOrder" href="Javascript:void(0)" onclick="showDiv('ddman','mantablediv')">订单管理</a></li>
                        <li class="admin-li"><a id="managerMsg" href="Javascript:void(0)" onclick="showDiv('lyman','mantablediv')">留言管理</a></li>
                        <li class="admin-li"><a id="managerTravel" href="Javascript:void(0)" onclick="showDiv('yjman','mantablediv')">游记管理</a></li>
                    </ul>
                </div>
                <div class="admin-sort">
                    <input onclick="sort(this)" type="button" class="sortList" id="default" value="默认排序"/>
                    <input onclick="sort(this)" type="button" class="sortList" id = "byTimeBig" value="按时间↑" />
                    <input onclick="sort(this)" type="button" class="sortList" id = "byTimeSmall" value="按时间↓" />
                </div>
                <div class="admin-table">
                    <!--总共五个table-->
                    <div class="mantablediv" id="yhman">
                        <table>
                            <thead>
                                <tr>
                                    <td>用户名</td>
                                    <td>真实姓名</td>
                                    <td>联系方式</td>
                                    <td>用户类型</td>
                                    <td>注册时间</td>
                                    <td>操作</td>
                                </tr>
                            </thead>
                            <tbody id="userList">
                            </tbody>
                        </table>
                    </div>
                    <div class="mantablediv" id="sfman">
                        <table>
                            <thead>
                                <tr>
                                    <td>沙发主人</td>
                                    <td>沙发坐标</td>
                                    <td>沙发类型</td>
                                    <td>沙主电话</td>
                                    <td>发布时间</td>
                                    <td>操作</td>
                                </tr>
                            </thead>
                            <tbody id="sofaList"></tbody>
                        </table>
                    </div>
                    <div class="mantablediv" id="ddman" class="canShow">
                        <table>
                            <thead>
                                <tr>
                                    <td>订单号</td>
                                    <td>使用人姓名</td>
                                    <td>使用人联系方式</td>
                                    <td>订单时间</td>
                                    <td>订单状态</td>
                                    <td>操作</td>
                                </tr>
                            </thead>
                            <tbody  id="orderList"></tbody>
                        </table>
                    </div>
                    <div class="mantablediv" id="lyman" class="canShow">
                        <table>
                            <thead>
                                <tr>
                                    <td>留言人</td>
                                    <td>内容</td>
                                    <td>留言时间</td>
                                    <td>操作</td>
                                </tr>
                            </thead>
                            <tbody id="msgList"></tbody>
                        </table>
                    </div>
                    <div class="mantablediv" id="yjman" class="canShow">
                        <table>
                            <thead>
                                <tr>
                                    <td>游记标题</td>
                                    <td>作者</td>
                                    <td>作者类型</td>
                                    <td>发表时间</td>
                                    <td>操作</td>
                                </tr>
                            </thead>
                            <tbody id="travelList"></tbody>
                        </table>
                    </div>
                </div>
          </div>
      </div>
</body>
</html>
